package com.ibeetl.cms.service;

import java.util.List;

import com.ibeetl.cms.entity.IndustrialTalents;
import com.ibeetl.cms.web.query.HighlevelTalentsQuery;
import com.ibeetl.cms.web.query.MedicalCareQuery;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.core.util.PlatformException;

import com.ibeetl.cms.dao.MedicalCareDao;
import com.ibeetl.cms.entity.MedicalCare;
import com.ibeetl.admin.core.service.BaseService;

/**
 * 医疗管理 Service
 */

@Service
@Transactional
public class MedicalCareService extends BaseService<MedicalCare>{

    @Autowired
    private MedicalCareDao medicalCareDao;

    public PageQuery<MedicalCare>queryByCondition(PageQuery query){
        PageQuery ret =  medicalCareDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelMedicalCare(List<Long> ids){
        try {
            medicalCareDao.batchDelMedicalCareByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除医疗管理失败", e);
        }
    }

    //查企业
    public PageQuery<MedicalCare>findenterprise(PageQuery query){
        PageQuery ret =  medicalCareDao.findenterprise(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public List<MedicalCare> queryCompany(MedicalCareQuery condtion) {
        List<MedicalCare> ret =  medicalCareDao.queryCompany(condtion);
        queryListAfter(ret);
        return ret;
    }

    public PageQuery<MedicalCare> queryEmployees(PageQuery page) {
        page.setPageSize(Integer.MAX_VALUE);

        PageQuery ret =  medicalCareDao.queryEmployees(page);
        queryListAfter(ret.getList());
        return ret;

    }
    public PageQuery<MedicalCare> queryDoneTask(PageQuery page) {
        PageQuery ret =  medicalCareDao.queryDoneTask(page);
        queryListAfter(ret.getList());
        return ret;

    }

    public int queryEmployeesCount(MedicalCareQuery condition) {
        return medicalCareDao.queryEmployeesCount(condition);
    }
}